<template>
  <div class="login" v-loading="loading">
    <div class="sencod-bg"></div>
  </div>
</template>
<script>
import ryglServer from "@/api/rygl";
import { getFldmList } from "@/utils/fldm";
export default {
  name: "loginJs",
  data() {
    return {
      form: {
        dlbm: "superadmin",
        dlmm: "ACB60BFA502A4F271D9B592B22D1BEFF1368C8FADF3476FEEFC1FE3B6DB9A71D"
      },
      loading: true
    };
  },
  created() {},
  mounted() {
    this.onSubmit();
  },
  methods: {
    async onSubmit() {
      const params = {
        ...this.form
      };
      ryglServer
        .loginJs(params)
        .then(res => {
          this.loading = false;
          this.$store.commit("SET_PERSONINFO", res.userInfo);
          this.$router.push("/index");
          // 登录成功后
          const fldmList = window.sessionStorage.getItem("fldmList");
          if (!fldmList) {
            getFldmList();
          }
        })
        .catch(err => {
          !err.isError && this.$message.warning(err.message);
        })
        .finally(() => {
          this.loading = false;
        });
    }
  }
};
</script>

<style scoped lang="scss">
.login {
  width: 100%;
  height: 100%;
  background-image: url("../assets/img/login/bj.jpg");
  background-size: 100% 100%;
  position: relative;
}
</style>
